package com.student.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.directwebremoting.annotations.DataTransferObject;
import org.directwebremoting.annotations.RemoteProperty;

/**
 * Dorm entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Dorm", schema = "dbo", catalog = "StudentManager")
public class Dorm implements java.io.Serializable {

	// Fields
	private Long dormId;
	private College college;
	private ClassInfo classInfo;
	private Profession profession;
	private String dormNumber;
	private Boolean sex;
	private Integer surplusBed;
	private Integer dormLevel;
	private Integer dormBedNumber;
	private Boolean dormForbidden;
	private Set<Student> students = new HashSet<Student>(0);
	private Set<DormRpAssociation> dormRpAssociations = new HashSet<DormRpAssociation>(
			0);

	// Constructors

	/** default constructor */
	public Dorm() {
	}

	/** minimal constructor */
	public Dorm(Long dormId, String dormNumber, Boolean sex,
			Integer surplusBed, Integer dormBedNumber, Boolean dormForbidden) {
		this.dormId = dormId;
		this.dormNumber = dormNumber;
		this.sex = sex;
		this.surplusBed = surplusBed;
		this.dormBedNumber = dormBedNumber;
		this.dormForbidden = dormForbidden;
	}

	/** full constructor */
	public Dorm(Long dormId, College college, ClassInfo classInfo,
			Profession profession, String dormNumber, Boolean sex,
			Integer surplusBed, Integer dormLevel, Integer dormBedNumber,
			Boolean dormForbidden, Set<Student> students,
			Set<DormRpAssociation> dormRpAssociations) {
		this.dormId = dormId;
		this.college = college;
		this.classInfo = classInfo;
		this.profession = profession;
		this.dormNumber = dormNumber;
		this.sex = sex;
		this.surplusBed = surplusBed;
		this.dormLevel = dormLevel;
		this.dormBedNumber = dormBedNumber;
		this.dormForbidden = dormForbidden;
		this.students = students;
		this.dormRpAssociations = dormRpAssociations;
	}

	// Property accessors
	@Id
	@Column(name = "Dorm_id", unique = true, nullable = false, precision = 18, scale = 0)
	@GeneratedValue
	public Long getDormId() {
		return this.dormId;
	}

	public void setDormId(Long dormId) {
		this.dormId = dormId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "College_id")
	public College getCollege() {
		return this.college;
	}

	public void setCollege(College college) {
		this.college = college;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Class_id")
	public ClassInfo getClassInfo() {
		return this.classInfo;
	}

	public void setClassInfo(ClassInfo classInfo) {
		this.classInfo = classInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Profession_id")
	public Profession getProfession() {
		return this.profession;
	}

	public void setProfession(Profession profession) {
		this.profession = profession;
	}

	@Column(name = "Dorm_Number", nullable = false, length = 40)
	public String getDormNumber() {
		return this.dormNumber;
	}

	public void setDormNumber(String dormNumber) {
		this.dormNumber = dormNumber;
	}

	@Column(name = "Sex", nullable = false)
	public Boolean getSex() {
		return this.sex;
	}

	public void setSex(Boolean sex) {
		this.sex = sex;
	}

	@Column(name = "Surplus_Bed", nullable = false)
	public Integer getSurplusBed() {
		return this.surplusBed;
	}

	public void setSurplusBed(Integer surplusBed) {
		this.surplusBed = surplusBed;
	}

	@Column(name = "Dorm_Level")
	public Integer getDormLevel() {
		return this.dormLevel;
	}

	public void setDormLevel(Integer dormLevel) {
		this.dormLevel = dormLevel;
	}

	@Column(name = "Dorm_Bed_Number", nullable = false)
	public Integer getDormBedNumber() {
		return this.dormBedNumber;
	}

	public void setDormBedNumber(Integer dormBedNumber) {
		this.dormBedNumber = dormBedNumber;
	}

	@Column(name = "Dorm_Forbidden", nullable = false)
	public Boolean getDormForbidden() {
		return this.dormForbidden;
	}

	public void setDormForbidden(Boolean dormForbidden) {
		this.dormForbidden = dormForbidden;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dorm")
	public Set<Student> getStudents() {
		return this.students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dorm")
	public Set<DormRpAssociation> getDormRpAssociations() {
		return this.dormRpAssociations;
	}

	public void setDormRpAssociations(Set<DormRpAssociation> dormRpAssociations) {
		this.dormRpAssociations = dormRpAssociations;
	}

}